import { Component } from '@angular/core';
import { Article } from './article/article.model';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  articles: Article[];

  constructor(){
    this.articles = [
      new Article('Angular 2','http://angular.io',10),
      new Article('Fulltask','http://fulltask.io',3),
      new Article('Angular HomePage','http://angular.io')
    ]
  }

  addArticle(title:HTMLInputElement, link:HTMLInputElement):boolean{
    console.log(`Adding article title: ${title.value} and link: ${link.value}`);
    this.articles.push(new Article(title.value,link.value));
    title.value = '';
    link.value = '';
    return false;
  }
}
